home *** CD-ROM | disk | FTP | other *** search
- Path: gate.net!pslfl2-14
- From: bhutto@gate.net (William Hutto)
- Newsgroups: comp.lang.c
- Subject: Re: Spawn and exit...
- Date: 11 Jan 1996 23:37:15 GMT
- Organization: CyberGate, Inc.
- Message-ID: <4d46vb$1vs0@news.gate.net>
- References: <4ckcjc$e84@oly.olympic.net> <DKyyE1.Bu5@news.zippo.com>
- NNTP-Posting-Host: pslfl2-14.gate.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <DKyyE1.Bu5@news.zippo.com>,
- Jim McFarland <jgm6@orkand.em.cdc.gov> wrote:
- >poke@oly.olympic.net (Charlie Chaplin ) wrote:
- >>I am having trouble writing a program that spwans my windows 3.11 then
- >>kills itself. I realize that windows 3.11 would be a child process. The
- >>parent process takes up so much memory that it slows my windows down too
- >>much. The program that I wrote was a result of my father's complaints.
- >>Whenever I get into debugging the computer I rem out the win statement in
- >>the autoexec.bat, because I tend to reboot the computer a lot when I'm
- >>debugging. This is a very long and tedious process if windows has to load
- >>up every time(yes I know about F5, read on and you will understand). The
- >>problem is, I forget to unrem the win statement, and my
- >>semi-literate father can't figure out how to get word 6.0 working(Yes
- >>I've told hime a million times to just type WIN), and he starts
- >>hollering at me. If I hit F5 during reboot I don't get the path
- >>statement the memory managers and the config.sys, which are necessary for
- >>what I'm doing. So I wrote a program called win.exe and I placed it in my
- >>root directory. WHen the autoexec.bat gets down to the win statement it
- >>executes the local win.exe file. win.exe pauses the computer for about 4
- >>seconds and then spawns windows 3.11. If any key is pressed during the 4
- >>second pause the program exits and I am left with a DOS prompt. I just
- >>need help getting my program to kill itself if it ends up spawning
- >>windows 3.11, win.exe takes up almost 80K of memory when it's resident. I
- >>have also tried the system() function, it does the same thing.
- >
- >Try using one of the execlp() type functions instead of spawning it.
-
- This is a simple MS-DOS question and would be better asked in
- comp.os.msdos.programmer or alt.msdos.programmer. Run your program from your
- autoexec.bat file and return a non-zero value if a key is pressed. Then check
- errorlevel when it returns to the batch file. You don't even need to delay
- because the keypress is going to be buffered anyway. Tell your dad not to
- touch any keys while it's booting.
-
- /*checkkey.c*/
- #include <conio.h>
-
- int main(void)
- {
-
- if(kbhit()) {
- getch();
- return 1;
- }
- return 0;
- }
-
- /*last two lines of autoexec.bat*/
- checkkey
- if not errorlevel 1 win
-
- Bill
-
- "Whatcha got on?...Your mind?"
-